package com.szzg10.thinking.chapter18;

import java.io.File;

public class MakeDirectories {

	public static void main(String[] args) {
		/*File oldFile = new File("d:/a.txt");
		File newFile = new File("d:/b.txt");
		
		oldFile.renameTo(newFile);
		printInfo(oldFile);
		System.out.println("----------------------------------------------------------");
		printInfo(newFile);*/
		
		/*File directory = new File("d:/c");
		directory.mkdirs();
		printInfo(directory);*/
		
		File deleteFile = new File("d:/b.txt");
		File deleteDirectory = new File("d:/c");
		
		deleteFile.delete();
		deleteDirectory.delete();
		printInfo(deleteFile);
		System.out.println("----------------------------------------------------------");
		printInfo(deleteDirectory);
	}
	
	private static void printInfo(File file) {
		System.out.println("AbsolutePath: " + file.getAbsolutePath());
		System.out.println("Read: " + file.canRead());
		System.out.println("Write: " + file.canWrite());
		System.out.println("Name: " + file.getName());
		System.out.println("Parent: " + file.getParent());
		System.out.println("Path: " + file.getPath());
		System.out.println("Length: " + file.length());
		System.out.println("LastModified: " + file.lastModified());
	}
	
}
